<?php

Loader::using("ext::libs::inscripcionesGenericas::QuestionBasedUIControlFilter");
Loader::using("ext::libs::phpUI::factories::ConstraintFactory");

class ConstraintUIControlFilter extends QuestionBasedUIControlFilter {

    public function &filterControl(UIControl &$newInstance) {
        $ConstraintName = $this->getQuestion()->getRestriccion() . "Constraint";
        $Constraint = ConstraintFactory::instance()->getConstraint($ConstraintName);
        if ($Constraint != null) {
            $newInstance->setConstraint($Constraint);
        }

        return $newInstance;
    }

}

?>